# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=iheartxor
pkgver=0.01
pkgrel=9
groups=('blackarch' 'blackarch-cracker')
pkgdesc='A tool for bruteforcing encoded strings within a boundary defined by a regular expression. It will bruteforce the key value range of 0x1 through 0x255.'
arch=('any')
url='http://hooked-on-mnemonics.blogspot.com.es/p/iheartxor.html'
license=('custom:unknown')
depends=('python2')
source=('http://codepad.org/TPrsNVU0/raw.py')
sha512sums=('72066ba178869ba55a144f258f8ea740a3e13589d11199276029cb0bd2225cc08e851c6a57008def2205a96fa816107a4d9b0f617b34fa77c38f4115bb2d2dfb')

prepare(){
  sed -i 's|env python|env python2|' raw.py

  mv raw.py "$pkgname.py"

  chmod +x "$pkgname.py"

  # fix path issues
  printf "#!/bin/bash\npython2 /usr/share/iheartxor/iheartxor.py" > "$pkgname.sh"
  chmod +x "$pkgname.sh"
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp --no-preserve=ownership "$pkgname.py" "$pkgname.sh" \
    "$pkgdir/usr/share/$pkgname"

  ln -s "/usr/share/$pkgname/$pkgname.sh" "$pkgdir/usr/bin/$pkgname"
}

